import com.jeeplus.common.utils.CommonUtils;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.common.utils.XmlUtils;
import com.jeeplus.modules.sys.utils.XMLParse;
import generate.GenerateSql;
import org.apache.http.util.TextUtils;
import org.dom4j.Element;
import org.junit.Test;
import org.nustaq.serialization.coders.JSONAsString;

import java.text.MessageFormat;

/**
 * @author Administrator
 * @title: sqldemo
 * @projectName JeePlus
 * @description: TODO
 * @date 2019/11/113:49
 */

public class sqldemo {
    private static StringBuffer sb = new StringBuffer();

    public static void main(String[] args) throws Exception {
        String str = " #serialVersionUID, #arId, #arNo, #name, #status, #infoTermYear, #infoTermNo# ";
    }

    @Test
    public static void getChildList(Element e) throws Exception {
        try {
            int i = 0;
            for (Element e1 : XmlUtils.getChildList(e)) {
                if (e1.getParent().attribute("prepend") != null) {
                    if (i > 0) {
                        sb.append(e1.attribute("prepend").getValue());
                        sb.append("\t");
                        sb.append(StringUtils.removeEnd(e1.getTextTrim(), "#"));
                        sb.append("\t");

                    } else {
                        sb.append(e1.getParent().attribute("prepend").getValue());
                        sb.append("\t");
                        sb.append(StringUtils.removeEnd(e1.getTextTrim(), "#"));
                        sb.append("\t");
                    }
                    sb.append("\r\n");
                }
                i++;
                if (XmlUtils.hasChild(e1)) {
                    getChildList(e1);
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new Exception(MessageFormat.format("【{0}】节点解析错误!", e.getName()));
        }
    }
}
